namespace PentaBiz
{
    public static class ArrayInitializerExtenions
    {

        /// <summary>
        /// Initializes the array with incremented values.
        /// </summary>
        /// <param name="doubles">The doubles.</param>
        /// <returns></returns>
        public static double[] InitializeArray(this double[] doubles)
        {
            double v = 0;
            for (int i = 0; i < doubles.GetLength(0); i++, v++)
                doubles[i] = v;


            return doubles;
        }
        /// <summary>
        /// Initializes the array with incremented values.
        /// </summary>
        /// <param name="doubles">The doubles.</param>
        /// <returns></returns>
        public static double[,] InitializeArray(this double[,] doubles)
        {
            double v = 0;
            for (int i = 0; i < doubles.GetLength(0); i++)
                for (int j = 0; j < doubles.GetLength(1); j++, v++)
                    doubles[i, j] = v;


            return doubles;
        }
        /// <summary>
        /// Initializes the array with incremented values.
        /// </summary>
        /// <param name="doubles">The doubles.</param>
        /// <returns></returns>
        public static double[, ,] InitializeArray(double[, ,] doubles)
        {
            double v = 0;

            for (int i = 0; i < doubles.GetLength(0); i++)
                for (int j = 0; j < doubles.GetLength(1); j++)
                    for (int k = 0; k < doubles.GetLength(2); k++, v++)
                        doubles[i, j, k] = v;


            return doubles;
        }

    }
}